<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <style>
        html{
            background-color: #ccc;
            height: 100vh;
            width: 100wh;
        }
        head{
            background-color: rosybrown;
            height: 100px;
            width: 100px;
            display: block;
        }

        /* p:only-child(){
            color: rosybrown;
        } */
        div span:only-of-type{
            color: salmon;
        }
    </style>


<div>
    <p>
        测试only
    </p>
    <p>
        测试only2
    </p>
    <span>asddasd</span>
</div>

</body>
</html>